package com.gx.smart.building.ui.repair.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.gx.smart.building.ui.repair.fragment.FinishFragment
import com.gx.smart.building.ui.repair.fragment.ProcessingFragment
import com.gx.smart.building.ui.repair.fragment.SuspendFragment
import com.gx.smart.building.ui.repair.fragment.WaitingFragment

/**
 * @author xiaosy
 * @create 2020/7/7
 * @Describe
 */
class PageAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> WaitingFragment.newInstance()
            1 -> ProcessingFragment.newInstance()
            2 -> SuspendFragment.newInstance()
            3 -> FinishFragment.newInstance()
            else -> WaitingFragment.newInstance()
        }
    }

    override fun getItemCount(): Int {
        return 4
    }

}